#ifndef _DKGL_COLOK_WATCH_H_
#define _DKGL_COLOK_WATCH_H_

#ifdef WIN32
	#include "dkglTimer_Win32.h"
#else
#endif

namespace DKGL
{

	class MillisecondTime
	{
		unsigned int m_milliseconds;
	public:
		MillisecondTime(unsigned int milliseconds)
			: m_milliseconds(milliseconds)
		{
		}
		
		MillisecondTime()
		{
		}

		static MillisecondTime current();

		unsigned int milliseconds_since(const MillisecondTime& other) const
		{
			return m_milliseconds - other.m_milliseconds;
		}
	};

	template<typename tick_type>
	inline MillisecondTime time_from_ticks(tick_type tick_count, tick_type ticks_per_sec)
	{
		static const int msec_per_sec = 1000;
		return MillisecondTime(static_cast<unsigned int>(tick_count / static_cast<double>(ticks_per_sec / msec_per_sec)));
	}

	class Timer
	{
		MillisecondTime m_start;

	public:
		void start()
		{
			m_start = MillisecondTime::current();
		}
		unsigned int elapsed_msec()
		{
			return MillisecondTime::current().milliseconds_since(m_start);
		}
	};

	extern Timer GlobalTimer;

	
	

class ClockWatch
{
public:
	ClockWatch();
	~ClockWatch();
	void start();
	double stop();
private:
	LARGE_INTEGER m_startTime, m_endTime, m_freq;
};

}

#endif